<template>
  <div class="add">
    <div>
      <slot name="top" />
    </div>
    <div class="form">
      <slot />
    </div>
    <div class="btn">
      <el-button v-if="bool" @click="$router.back()">返回</el-button>
      <el-button v-else @click="backFn">上一步</el-button>
      <el-button v-if="bool" @click="addFn">提交</el-button>
      <el-button v-else @click="backIndex">提交</el-button>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    bool: {
      type: Boolean,
      default: () => true
    }
  },
  methods: {
    addFn() {
      this.$emit('addFn')
    },
    backFn() {
      this.$emit('backFn')
    },
    backIndex() {
      this.$emit('backFn')
    }
  }
}
</script>

<style lang="scss" scoped>
@import '@/styles/detail-form.scss';
</style>
